package ch08_Swing高级组件.dialog;

import ch07_GUI编程.ImageFactory;

import javax.swing.*;

public class LoginDialog extends JDialog {
	JLabel nameLab = new JLabel("用户名:");
	JLabel pswLab = new JLabel("密    码:");
	JTextField nameTf = new JTextField();
	JPasswordField pswPf = new JPasswordField();
	JButton cancelBtn = new JButton("cancel");
	JButton loginBtn = new JButton("longin");

	public LoginDialog(JFrame parent) {
		super(parent,"登录",true);
		setLayout(null);
		nameLab.setSize(50, 20);
		nameLab.setLocation(10, 10);
		this.add(nameLab);
		nameTf.setSize(100, 10);
		nameTf.setLocation(60, 15);
		this.add(nameTf);
		pswLab.setSize(50, 20);
		pswLab.setLocation(10, 30);
		this.add(pswLab);
		pswPf.setSize(100, 10);
		pswPf.setLocation(60, 35);
		this.add(pswPf);
		cancelBtn.setSize(40, 20);
		cancelBtn.setLocation(70, 60);
		this.add(cancelBtn);
		loginBtn.setSize(40, 20);
		loginBtn.setLocation(120, 60);
		this.add(loginBtn);
		setIconImage(ImageFactory.create("login.png").getImage());
	}
}
